package com.cdy.sample_config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
//@EnableConfigServer
@EnableDiscoveryClient
@RefreshScope
@RestController
public class SampleConfigApplication {

    public static void main(String[] args) {
        SpringApplication.run(SampleConfigApplication.class, args);
    }
    
    @Value("${server.port}")
    private String from;

    @RequestMapping("/from")
    //动态修改配置文件的值。
    public String from() {
        return this.from;
    }
 
}
